package ru.dc.object.commands;

/**
 * <pre>
 * User: Penkov Vladimir
 * Date: 08.10.2010
 * Time: 16:34:13
 * </pre>
 */
public class Key extends Command {

    private String key;

    @Override
    public String generateCommand() {
        return getActualCommandName()+" "+getKey();
    }

    @Override
    public void parseCommand() {
        if (getCommand().length()>5) {
            setKey(getCommand().substring(5));
        }
        else {
            setKey(null);
        }
    }

    @Override
    public String getActualCommandName() {
        return "$Key";
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }
}
